
import java.util.Arrays;
import java.util.Scanner;

class NGuessNumber {

    public static int[] numbers=new int[4];
    public static int[] guesslist=new int[4];
    public static int a_num = 0;
    public static int b_num = 0;




    public static int[] generateAnswer(){
        //随机生成4个0-9之间的不重复的整型数作为答案并返回的功能。
        int index = 0;

        while (true) {
            int random = (int)(Math.random() * 9 + 1);
            int j = 0;
            for ( ; j < numbers.length; j++) {
                if(random == numbers[j]) {
                    break;
                }
            }
            if(j == numbers.length ) {
                numbers[index++] = random;
            }
            if (index == 4) {
                break;
            }
        }
        //System.out.println("答案："+Arrays.toString(numbers));
        //System.out.println(Arrays.toString(numbers).length());
        //System.out.println(numbers.length);
        //System.out.println(numbers);
        return numbers;
    }
    }